<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- React核心包 最先引入  提供一个对象React -->
  <script src="../../react资料_stu/依赖包/react.development.js"></script>
  <!-- ReactDOM包  提供一个对象ReactDOM -->
  <script src="../../react资料_stu/依赖包/react-dom.development.js"></script>
  <!-- babel -->
  <script src="../../react资料_stu/依赖包/babel.min.js"></script>
</head>

<body>
  <!--       diff算法的比较
        Diff算法比较只会在同层级进行, 不会跨层级比较,如果当前层级不一致则直接替换
        diff算法在某个层级比较一致的话,会进入层级内部再次比较,默认按照DOM书写顺序进行比较

        伪代码:
        旧的虚拟DOM
          <li>html</li>
          <li>css</li>
          <li>js</li>

        新的虚拟DOM
          <li>react</li>
          <li>html</li>
          <li>css</li>
          <li>js</li> -->
  <!-- react操作的容器 -->
  <button id="btn">点击重新渲染修改内容</button>
  <div id="app"></div>
</body>

<script type="text/babel">

  const score = ["html", "js", "css", "vue"]

  const jsx = (
    <ul>
      {
        score.map((item) => {
          return <li>{item}</li>
        })
      }
    </ul>
  )
  const root = ReactDOM.createRoot(document.getElementById('app'));
  root.render(jsx)



  const oBtn = document.querySelector("#btn")
  oBtn.onclick = function () {
    score.unshift ("springboot")
    const jsx = (

        <ul>
        {
          score.map((item) => {
            return <li>{item}</li>
          })
        }
      </ul>

    )
    root.render(jsx)




  }





</script>

</html>